import request from '@/config/axios'

// 工作记录 VO
export interface JobRecordVO {
  id: number // id
  jobType: number // 作业类型
  docId: number // 医生编号
  docName: string // 医生名称
  devId: string // 设备编号
  patId: string // 患者编号
  patName: string // 患者名称
  jobTime: Date // 作业时间
  summary: number // 作业概要
  remark: string // 备注
  paid: number
}

export interface JobStatisticVO {
  jobType: number
  docId: number
  docName: string
  jobCount: number
  year: number
  month: number
}

// 工作记录 API
export const JobRecordApi = {
  // 查询工作记录分页
  getJobRecordPage: async (params: any) => {
    return await request.get({ url: `/ecg/job-record/page`, params })
  },

  // 查询用户自己的工作记录分页
  getJobRecordDoctorPage: async (params: any) => {
    return await request.get({ url: `/ecg/job-record/doctor-page`, params })
  },

  // 查询工作记录详情
  getJobRecord: async (id: number) => {
    return await request.get({ url: `/ecg/job-record/get?id=` + id })
  },

  // 新增工作记录
  createJobRecord: async (data: JobRecordVO) => {
    return await request.post({ url: `/ecg/job-record/create`, data })
  },

  // 修改工作记录
  updateJobRecord: async (data: JobRecordVO) => {
    return await request.put({ url: `/ecg/job-record/update`, data })
  },

  // 删除工作记录
  deleteJobRecord: async (id: number) => {
    return await request.delete({ url: `/ecg/job-record/delete?id=` + id })
  },

  // 导出工作记录 Excel
  exportJobRecord: async (params) => {
    return await request.download({ url: `/ecg/job-record/export-excel`, params })
  },

  // 作业统计
  jobStatistic: async (params) => {
    return await request.get({ url: `/ecg/job-record/job-statistic`, params })
  },
}